package com.mk.cloud.common.domain;
import org.beetl.sql.core.annotatoin.AssignID;
import org.beetl.sql.core.annotatoin.Param;
import org.beetl.sql.core.annotatoin.SqlStatement;
import org.beetl.sql.core.annotatoin.SqlStatementType;
import org.beetl.sql.core.mapper.BaseMapper;

import javax.persistence.Transient;
import java.io.Serializable;
import java.math.*;
import java.util.Date;
import java.sql.Timestamp;
import java.util.List;

/*
* 
* gen by beetlsql 2018-01-18
*/
public class CpMsgTemplete   implements Serializable{
	//模板主键
	@AssignID
	private String mtid ;
	//附件地址
	private String attachmentname ;
	private String attachmenturl ;
	//是否已经发送（0否，1是）
	private String issend ;
	//级别
	private String mlevel ;
	//打开页面标题
	private String mopentitle ;
	//图片
	private String mpic ;
	//消息内容
	private String msg ;
	//消息类型
	private String msgtype ;
	//创建时间
	private String mtime ;
	//标题
	private String mtitle ;
	//打开地址
	private String murl ;
	//与发送层级相关
	private String otherid ;
	@Transient
	private String othername;
	//发送层级（0全部，1企业 otherid=coid）
	private String sendlevel ;
	
	public CpMsgTemplete() {
	}

	public String getOthername() {
		return othername;
	}

	public void setOthername(String othername) {
		this.othername = othername;
	}

	public String getMtid(){
		return  mtid;
	}
	public void setMtid(String mtid ){
		this.mtid = mtid;
	}

	public String getAttachmentname() {
		return attachmentname;
	}

	public void setAttachmentname(String attachmentname) {
		this.attachmentname = attachmentname;
	}

	public String getAttachmenturl() {
		return attachmenturl;
	}

	public void setAttachmenturl(String attachmenturl) {
		this.attachmenturl = attachmenturl;
	}

	public String getIssend(){
		return  issend;
	}
	public void setIssend(String issend ){
		this.issend = issend;
	}
	
	public String getMlevel(){
		return  mlevel;
	}
	public void setMlevel(String mlevel ){
		this.mlevel = mlevel;
	}
	
	public String getMopentitle(){
		return  mopentitle;
	}
	public void setMopentitle(String mopentitle ){
		this.mopentitle = mopentitle;
	}
	
	public String getMpic(){
		return  mpic;
	}
	public void setMpic(String mpic ){
		this.mpic = mpic;
	}
	
	public String getMsg(){
		return  msg;
	}
	public void setMsg(String msg ){
		this.msg = msg;
	}
	
	public String getMsgtype(){
		return  msgtype;
	}
	public void setMsgtype(String msgtype ){
		this.msgtype = msgtype;
	}
	
	public String getMtime(){
		return  mtime;
	}
	public void setMtime(String mtime ){
		this.mtime = mtime;
	}
	
	public String getMtitle(){
		return  mtitle;
	}
	public void setMtitle(String mtitle ){
		this.mtitle = mtitle;
	}
	
	public String getMurl(){
		return  murl;
	}
	public void setMurl(String murl ){
		this.murl = murl;
	}
	
	public String getOtherid(){
		return  otherid;
	}
	public void setOtherid(String otherid ){
		this.otherid = otherid;
	}
	
	public String getSendlevel(){
		return  sendlevel;
	}
	public void setSendlevel(String sendlevel ){
		this.sendlevel = sendlevel;
	}
	
	public interface Mapper extends BaseMapper<CpMsgTemplete>{

		/**
		 * 根据主键查询消息
		 * @param mtid
		 * @return
		 */
		CpMsgTemplete selectSingleById(@Param("mtid")String mtid);

		/**
		 * 根据主键删除
		 * @param mtid
		 * @return
		 */
		Integer deleteSingleById(@Param("mtid")String mtid);

		/**
		 * 插入到消息表具体发出
		 * @param mtid
		 * @param sendlevel
		 * @param now
		 */
		@SqlStatement(type= SqlStatementType.INSERT)
		void insertMsgByMsgTemplete(@Param("mtid")String mtid,@Param("sendlevel")String sendlevel,@Param("now")String now);

		/**
		 * 根据查询要发送的消息
		 * @param mtid
		 * @return
		 */
		List<CpMsg> selectAllMsgToSend(@Param("mtid")String mtid);
//		String selectAllMsgToSend(@Param("mtid")String mtid,@Param("page")Integer page,@Param("pagesize")Integer pagesize);

		/**
		 * 要发送的消息条数
		 * @param mtid
		 * @return
		 */
		Integer selectCountMsgToSend(@Param("mtid")String mtid);
	}
	

}
